package com.liao.jta_jpa.service.impl;

import com.liao.jta_jpa.dao.test.UserDao;
import com.liao.jta_jpa.dao.test1.User1Dao;
import com.liao.jta_jpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    @Autowired
    private User1Dao user1Dao;

    @Transactional
    @Override
    public void updateUser() {
        System.out.println(userDao.updateData(24, "111111"));
        System.out.println(user1Dao.updateData(23, "111111"));
    }

    @Transactional
    @Override
    public void updateUser1() {
        System.out.println(userDao.updateData(24, "222222"));
        int o = 1/0;
        System.out.println(user1Dao.updateData(23, "222222"));
    }
}
